package minsat;

import java.util.HashSet;
import java.util.Set;

/**
 * Simple combination of a double representing a bound (usually a lower bound) and a list of
 * bindings which yield that bound. This is the ultimate return type of the MinSatz algorithm and is
 * used throughout to track bindings and compare the results of branching calls.
 */
public class BindingsAndBound
{
  public Set<Binding> bindings;
  public Double bound;

  public BindingsAndBound()
  {
    bindings = new HashSet<Binding>();
    bound = Double.NEGATIVE_INFINITY;
  }

  public BindingsAndBound(BindingsAndBound o)
  {
    this();
    if (o != null) {
      bindings = new HashSet<Binding>(o.bindings);
      bound = o.bound;
    }
  }

  public String toString()
  {
    String ret = "Bindings:\n";
    for (Binding b : bindings)
      ret += b + "\n";
    ret += "Bound: " + bound;
    return ret;
  }
}
